cmake_minimum_required(VERSION 3.10)

project(onvifclient)

add_compile_options(-DWITH_OPENSSL)
add_compile_options(-DWITH_NONAMESPACES)
add_compile_options(-DWITH_DOM)

# find_package(OpenCV REQUIRED)

# if (NOT OpenCV_FOUND)
#     message(FATAL_ERROR "opencv Not Found!")
# else ()
#     message(STATUS "OpenCV_LIBS: ${OpenCV_LIBS}")
#     message(STATUS "OpenCV_INCLUDE_DIRS: ${OpenCV_INCLUDE_DIRS}")
# endif (NOT OpenCV_FOUND)
# include_directories(${OpenCV_INCLUDE_DIRS})

include_directories(/usr/local/include)
set(ffmpeglibs /usr/local/lib/libavcodec.so 
    /usr/local/lib/libswscale.so
    /usr/local/lib/libavfilter.so
    /usr/local/lib/libavdevice.so
    /usr/local/lib/libavformat.so
    /usr/local/lib/libavutil.so
    /usr/local/lib/libswresample.so)


include_directories(onvif)
add_subdirectory(onvif)

# set(SRC main_discovery.c 
# onvif_comm.c 
# onvif_dump.c
# )

# add_executable(onvifclient ${SRC})
# target_link_libraries(onvifclient onvif ssl crypto ${ffmpeglibs} ${OpenCV_LIBS})

# 设备搜索
add_executable(main_discovery main_discovery.c onvif_comm.c onvif_dump.c)
target_link_libraries(main_discovery onvifLib ssl crypto)

# 获取设备基本信息
add_executable(main_deviceinfo main_deviceinfo.c onvif_comm.c onvif_dump.c)
target_link_libraries(main_deviceinfo onvifLib ssl crypto)

# 读取rtsp音视频流
add_executable(main_avstream main_avstream.c onvif_comm.c onvif_dump.c)
target_link_libraries(main_avstream onvifLib ssl crypto ${ffmpeglibs})

# 图像抓拍
add_executable(main_snapshot main_snapshot.c onvif_comm.c onvif_dump.c)
target_link_libraries(main_snapshot onvifLib ssl crypto)

# 修改分辨率
add_executable(main_SetResolution main_SetResolution.c onvif_comm.c onvif_dump.c)
target_link_libraries(main_SetResolution onvifLib ssl crypto)

# 获取设备能力
add_executable(main_capabilities main_capabilities.c onvif_comm.c onvif_dump.c)
target_link_libraries(main_capabilities onvifLib ssl crypto)

# 设备校时
add_executable(main_systemtime main_systemtime.c onvif_comm.c onvif_dump.c)
target_link_libraries(main_systemtime onvifLib ssl crypto)

# 遮挡报警
# add_executable(main_alarm main_alarm.c onvif_comm.c onvif_dump.c)
# target_link_libraries(main_alarm onvifLib ssl crypto)
